import React, {Component} from 'react';
import MenuPopWindow from '../views/PopupWindow';
import Utils from '../Utils';
import {
  StyleSheet,
  Text,
  View,
  Image,
  Dimensions,
  TouchableOpacity,
  Button,
  Platform
} from 'react-native';

const {width, height} = Dimensions.get('window');
import {Toast,ModalIndicator,SearchInput} from 'teaset';
export default class TitleBar extends Component {
    constructor(props) {
        super(props);
        this.state = {
            showPop: false,
        }
    }

    renderAndroid() {
        return (
            <View style={styles.container}>
              <View style={styles.titleView}>
                <Text style={styles.titleMsg}>通讯录</Text>
                <TouchableOpacity
                    onPrss={()=>Actions.AddFriendPage()}
                    style={styles.titleImgView}>
                  <Image
                      style={styles.titleImg}
                      source={ImageUtil.AddFriend}/>
                </TouchableOpacity>
              </View>
            </View>
        );
    }

    renderIOS() {
        return (
            <View style={styles.container}>
              <View style={styles.titleView}>
                <Text style={styles.titleMsg}>通讯录</Text>
                <TouchableOpacity
                    onPrss={()=>Actions.AddFriendPage()}
                    style={styles.titleImgView}>
                  <Image
                      style={styles.titleImg}
                      source={ImageUtil.AddFriend}/>
                </TouchableOpacity>
              </View>
            </View>
        );
    }

    render() {
        if (Platform.OS === 'ios') {
            return this.renderIOS();
        }
        return this.renderAndroid();
    }
}




const styles = StyleSheet.create({
    container: {
        backgroundColor:'#f0f0f0',
    },
    titleView:{
        backgroundColor:'#000000',
        width:width,
        alignItems:'center',
        justifyContent:'center'
    },
    titleMsg:{
        textAlign:'center',
        fontSize:20,
        color:'#ffffff',
        marginTop:34,
        marginBottom:29/2
    },
    titleImg:{
        height:20,
        width:20
    },
    titleImgView:{
        position:'absolute',
        bottom:27/2,right:15
    },
    searchInput:{
        width:width-30,
        height:29,
        borderWidth:1,
        borderColor:'#c2c2c2',
        marginTop:12
    },
    labelView:{
        height:45,
        width:width,
        backgroundColor:'#ffffff',
        borderBottomWidth:1,
        borderTopWidth:1,
        borderColor:'#e2e2e3',
        marginTop:12,
        flexDirection:'row',
        alignItems:'center'
    },
    labelChangeView:{
        width:width,
        backgroundColor:'#ffffff',
        borderBottomWidth:1,
        borderTopWidth:1,
        borderColor:'#e2e2e3',
        marginTop:12,
        alignItems:'center'
    },
    labelImg:{
        marginLeft:15,
        width:30,
        height:30,
        borderRadius:5
    },
    labelMsg:{
        marginLeft:19,
        fontSize:14,
        color:'#000000'
    },
});
